pub struct Solution;

impl Solution {
    pub fn arrange_coins(n: i32) -> i32 {
        let mut count = 0;
        let mut tmp = n;
        for i in 1..=n {
            if tmp >= i {
                tmp -= i;
                count += 1;
            } else {
                break;
            }
        }
        count
    }
}